<template>
  <div>
    <div id="box"></div>
    <vertical-menu></vertical-menu>
    <div class="tabbar">
      <div id="circle1"></div>
      <div id="circle2"></div>
      <div class="page-header">
        <i class="el-icon-department iconfont"></i>
        <span>Department</span>
      </div>
    </div>
    <div id="base">
      <div class="content">
        <div class="collapse-item" v-for="(item,index) in deDetail" :key="index">
          <div class="title">
            <div class="department">
              <el-row class="first-row">
                <i class="el-icon-department iconfont"></i>
                <span>{{item.name}}</span>
                <div
                  class="symbol"
                  :style="{'background-color': item.color+''}"></div>
              </el-row>
              <el-row class="second-row">
                <div>
                  <i class="el-icon-manager iconfont"></i>
                </div>
                <div class="manager">
                  <!-- <span>{{item.managername}}</span> -->
                  <span v-for="(item,index) in item.managername" :key="index">{{item}}</span>
                </div>
                <i class="el-icon-file-editing iconfont" @click="handleOpenEdit(index)"></i>
                <div class="icon">
                  <i class="el-icon-add iconfont" @click="addDialogVisible = true, addStaffToDepartment.index=index"></i>
                  <i class="el-icon-arrow-right"  @click="tableVisibleChange(index)" v-bind:class="{'active':item.tableVisible, 'back':!item.tableVisible}"></i>
                </div>
              </el-row>
            </div>
          </div>
          <div class="depart-table" v-show="item.tableVisible">
            <el-table
                :data="item.tableData"
                :cell-style="{textAlign:'center'}"
                :header-cell-style="{background:'rgba(238, 229, 185,0.4)',textAlign:'center',color:'#606266',fontWeight:'600'}"
                border>
              <el-table-column
                show-overflow-tooltip
                prop="name"
                label="Name">
              </el-table-column>
              <el-table-column
                show-overflow-tooltip
                prop="position"
                label="Position">
              </el-table-column>
              <el-table-column
                prop="minHours"
                label="Minimum hours">
              </el-table-column>
              <el-table-column
                label="Department"
                width="200">
                <template slot-scope="props">
                  <div
                    v-for="(name,index) in props.row.department"
                    :key="index">
                    {{ name }}
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                label="Operation"
                width='100px'>
                <template slot-scope="slot">
                  <i class="el-icon-delete iconfont" @click="deleteFromDepart(index, slot.row.number)"></i>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
      <div class="employee">
        <div class="editDe" @click="editDepartmentsVisible = true">
          <i class="el-icon-add iconfont"></i>
          <span>Edit Department</span>
        </div>
        <div class="employee-detail">
          <el-input
            v-model="search"
            class="search-staff"
            placeholder="search for staff"
            prefix-icon="el-icon-search">
          </el-input>
          <el-table
            class="staff-list"
            :data="staffPageData"
            :cell-style="{textAlign:'center'}"
            :header-cell-style="{background:'rgba(238, 229, 185,0.4)',textAlign:'center',color:'#606266',fontWeight:'600'}"
            border>
            <el-table-column
              show-overflow-tooltip
              prop="name"
              label="Name">
            </el-table-column>
            <el-table-column
              show-overflow-tooltip
              prop="position"
              label="Position">
            </el-table-column>
            <el-table-column
              prop="minHours"
              label="Minimum hours">
            </el-table-column>
            <el-table-column
              label="Operation">
              <template slot-scope="scope">
                <i class="el-icon-file-editing iconfont" @click="editStaff(scope.row)"></i>
                <i class="el-icon-delete iconfont" @click="deleteStaff(scope.row)"></i>
              </template>
            </el-table-column>
          </el-table>
          <el-pagination
            class="page"
            background
            @current-change="handleCurrentChange"
            :current-page="page.pageNum"
            :page-size="page.pageSize"
            :page-count="5"
            layout="prev, pager, next"
            :total="page.totalSize">
          </el-pagination>
          <div class="add-staff" @click="addStaffDialogVisible = true">
            <i class="el-icon-add iconfont"></i>
            <span>Add</span>
          </div>
        </div>
      </div>
    </div>

    <el-dialog
      title="Add"
      :visible.sync="addDialogVisible"
      width="30%">
      <el-form ref="addStaffToDepartment" :model="addStaffToDepartment" label-width="80px">
        <el-form-item label="Name: ">
          <el-select v-model="addStaffToDepartment.number" filterable placeholder="Please Select">
            <el-option
              v-for="item in staffData"
              :key="item.value"
              :label="item.name"
              :value="item.number">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addDialogVisible = false">Cancel</el-button>
        <el-button type="primary" @click="addStaffTo()">Submit</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="AddStaff"
      :visible.sync="addStaffDialogVisible"
      width="35%">
      <el-form ref="addStaffRef" :model="staffInfo" :rules="editStaffRules" label-width="120px">
        <el-form-item label="Name: " prop="name">
          <el-input v-model="staffInfo.name" placeholder=""></el-input>
        </el-form-item>
        <el-form-item label="Email Address: " prop="email">
          <el-input v-model="staffInfo.email" placeholder=""></el-input>
        </el-form-item>
        <el-form-item label="Sex: " prop="sex">
          <el-radio-group v-model="staffInfo.sex">
            <el-radio label="Male">Male</el-radio>
            <el-radio label="Female">Female</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="Minimun hours: " prop="miniHours">
          <el-select v-model="staffInfo.miniHours">
            <el-option :label="20" :value="20"></el-option>
            <el-option :label="30" :value="30"></el-option>
            <el-option :label="40" :value="40"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="Position: " prop="position">
          <el-select v-model="staffInfo.position">
            <el-option label="Staff" value="Staff"></el-option>
            <el-option label="Manager" value="Manager"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handlecloseAddStaff">Cancel</el-button>
        <el-button type="primary" @click="addStaff">Submit</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="EditStaff"
      :visible.sync="editStaffDialogVisible"
      width="35%">
      <el-form ref="addStaffRef" :model="staffInfo" :rules="editStaffRules" label-width="120px">
        <el-form-item label="Name: " prop="name">
          <el-input v-model="staffInfo.name" placeholder=""></el-input>
        </el-form-item>
        <el-form-item label="Email Address: " prop="email">
          <el-input v-model="staffInfo.email" placeholder="" disabled></el-input>
        </el-form-item>
        <el-form-item label="Sex: " prop="sex">
          <el-radio-group v-model="staffInfo.sex" disabled>
            <el-radio label="Male">Male</el-radio>
            <el-radio label="Female">Female</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="Minimun hours: " prop="miniHours">
          <el-select v-model="staffInfo.miniHours">
            <el-option :label="20" :value="20"></el-option>
            <el-option :label="30" :value="30"></el-option>
            <el-option :label="40" :value="40"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="Position: " prop="position">
          <el-select v-model="staffInfo.position">
            <el-option label="Staff" value="Staff"></el-option>
            <el-option label="Manager" value="Manager"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handlecloseEditStaff">Cancel</el-button>
        <el-button type="primary" @click="updateStaff">Submit</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="Edit Department"
      :visible.sync="editDepartmentsVisible"
      width="30%">
      <el-dialog
        width="25%"
        title="Add Department"
        :visible.sync="innerVisible"
        append-to-body>
        <el-form :model="departmentInfo" label-width="100px">
          <el-form-item label="Name">
            <el-input v-model="departmentInfo.name" placeholder="department name"></el-input>
          </el-form-item>
          <el-form-item label="Manager">
            <el-select v-model="departmentInfo.manager" multiple collapse-tags placeholder="select manager">
              <el-option
                v-for="item in managerData"
                :key="item.number"
                :label="item.name"
                :value="item.number">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="Color">
            <el-color-picker v-model="departmentInfo.color" size="mini" :predefine="colors"></el-color-picker>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="handlecloseInner">Cancel</el-button>
          <el-button type="primary" @click="addDepartment">Submit</el-button>
        </span>
      </el-dialog>
      <div class="edit-department">
        <div class="title">
          <span>department</span>
          <span>
            <i class="el-icon-add iconfont" @click="innerVisible = true"></i>
          </span>
        </div>
        <div
          class="department-list"
          v-for="(item,index) in department"
          :key="index">
          <span>{{item.name}}</span>
          <span style="float:right">
            <i class="el-icon-delete iconfont" @click="deleteDepart(item.id)"></i>
          </span>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="editDepartmentsVisible=false">confirm</el-button>
      </span>
    </el-dialog>
    <el-dialog
      width="25%"
      title="Update Department"
      :visible.sync="editDeVisible"
      append-to-body>
      <el-form :model="editDepartmentInfo" label-width="100px">
        <el-form-item label="Name">
          <el-input v-model="editDepartmentInfo.name" placeholder="department name"></el-input>
        </el-form-item>
        <el-form-item label="Manager">
          <el-select v-model="editDepartmentInfo.manager" multiple collapse-tags placeholder="select manager" @change="$forceUpdate()">
            <el-option
              v-for="item in managerData"
              :key="item.number"
              :label="item.name"
              :value="item.number">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="Color">
          <el-color-picker v-model="editDepartmentInfo.color" size="mini" :predefine="colors"></el-color-picker>
          <!-- <el-select v-model="departmentInfo.color" placeholder="select">
            <el-option :label="" :value=""></el-option>
          </el-select> -->
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editDeVisible = false">Cancel</el-button>
        <el-button type="primary" @click="editDepartment">Submit</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import VerticalMenu from '@/components/VerticalMenu.vue'
export default {
  components: {
    VerticalMenu
  },
  data() {
    let validName=(rule,value,callback)=>{
      if (!value){
        return callback(new Error('Name is required'))
      } else {
        callback()
      }
    };
    var checkEmail = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('Email is required'));
      } else {
        const reg = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-zd]{2,5}$/
        if (reg.test(value)) {
          callback();
        } else {
          return callback(new Error('Please enter the correct email'));
        }
      }
    };
    let validMiniHours=(rule,value,callback)=>{
      if (!value){
        return callback(new Error('Minimun hours is required'))
      } else {
        callback()
      }
    };
    let validPosition=(rule,value,callback)=>{
      if (!value){
        return callback(new Error('Position is required'))
      } else {
        callback()
      }
    };
    return {
      addStaffDialogVisible: false,
      editStaffDialogVisible: false,
      editDepartmentsVisible: false,
      innerVisible: false,
      editDeVisible: false,
      departmentInfo: {
        name: '',
        manager: [],
        color: '',
      },
      staffInfo: {
        number: '',
        name: '',
        email: '',
        sex: 'Male',
        miniHours: '',
        position: '',
      },
      editDepartmentInfo: {},
      editStaffRules: {
        name: [
          { validator: validName, trigger: 'blur' }
        ],
        email: [
          { validator: checkEmail, trigger: 'blur'}
        ],
        miniHours: [
          { validator: validMiniHours, trigger: 'change' }
        ],
        position: [
          { validator: validPosition, trigger: 'change' }
        ],
      },
      colors: [
        '#FBADAD',
        '#CCABCD',
        '#84A4F7',
        '#F7CB84',
        '#C3CFE2',
        '#E2D1C3',
        '#2AF598',
        '#C2E9FB',
        '#F093FB',
        '#F9F047'
      ],
      department: '',
      deDetail: [],
      search: '',
      staffData: [],
      managerData: [],
      staffPageData: [],
      addDialogVisible: false,
      addStaffToDepartment: {
        number: '',
        index: '',
      },
      page: {
        totalSize: 2,
        pageNum: 1,
        pageSize: 7
      },
    }
  },
  created(){
    this.getPageStaff();
    this.getAllStaff();
    this.department = JSON.parse(sessionStorage.getItem('department'));
    if(this.department === null || this.deDetail === null){
      this.getAllDepartment();
    }
    this.getDeDetail();
  },
  methods: {
    tableVisibleChange(index){
      const _this = this
      if(_this.deDetail[index]["tableVisible"] === false) {
        _this.getDepartStaff(index);
        _this.deDetail[index]["tableVisible"] = true;
      } else {
        _this.deDetail[index]["tableVisible"] = false;
      }
    },
    getAllStaff() {
      const _this = this;
      _this.$api.staff.getAllStaff({}).then(res => {
        if (res.data.code === 2000) {
          _this.staffData = res.data.data;
          sessionStorage.setItem('staffData',JSON.stringify(_this.staffData));
          _this.managerData = _this.staffData.filter((item) => {
            return item.position != 'Staff'
          })
          sessionStorage.setItem('managerData',JSON.stringify(_this.managerData));
        } else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    getPageStaff(){
      const _this = this
      _this.$api.staff.getAllStaff({
        page: _this.page.pageNum,
        rows: _this.page.pageSize,
        paging: true
      }).then(res => {
        if (res.data.code === 2000) {
          _this.staffPageData = res.data.data.list;
          _this.page.totalSize = res.data.data.total;
          // _this.sortPosition(_this.staffData)
        } else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    handleCurrentChange(val) {
      const _this = this;
      _this.page.pageNum = val;
      _this.getPageStaff();
    },
    getAllDepartment() {
      const _this = this
      _this.$api.department.getAllDepartment().then(res => {
        if (res.data.code === 2000) {
          _this.department = res.data.data;
          sessionStorage.setItem('department',JSON.stringify(_this.department));
          _this.getDeDetail();
        } else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    // getManager() {
    //   const _this = this;
    //   for(var i=0;i<_this.department.length;i++){
    //     _this.$api.department.getManager({
    //       departmentid: _this.department[i].id,
    //     }).then(res => {
    //       if(res.data.code === 2000){
    //         _this.department[i]['manager']=res.data.data;
    //       } else {
    //         _this.$message.error(res.data.message);
    //       }
    //     }).catch(err => {
    //       console.log(err);
    //     })
    //   }
    // },
    // sortPosition(staffData){
    //   const _this = this
    //   for(var i=0;i<staffData.length-1;i++) {
    //     for(var j=i+1;j<staffData.length;j++) {
    //       if(staffData[i].position > staffData[j].position){
    //         var temp = staffData[i]
    //         staffData[i] = staffData[j]
    //         staffData[j] = temp
    //       } else if (staffData[i].position === staffData[j].position && staffData[i].name > staffData[j].name){
    //         var temp = staffData[i]
    //         staffData[i] = staffData[j]
    //         staffData[j] = temp
    //       }
    //     }
    //   }
    //   // console.log(staffData)
    // },
    addStaff(){
      const _this=this;
      _this.$refs.addStaffRef.validate(valid => {
        if(!valid) return;
        _this.$api.staff.addStaff({
          name: _this.staffInfo.name,
          sex: _this.staffInfo.sex,
          emailAddress: _this.staffInfo.email,
          position: _this.staffInfo.position,
          minHours: _this.staffInfo.miniHours,
        }).then(res => {
          if(res.data.code === 2000){
            _this.getAllStaff();
            _this.getPageStaff();
            _this.$message.success('Add successful');
            // this.staffInfo = {
            //   number: '',
            //   name: '',
            //   email: '',
            //   sex: 'Male',
            //   miniHours: '',
            //   position: '',
            // };
            // _this.addStaffDialogVisible = false;
          }else{
            _this.$message.error(res.data.message);
          }
        }).catch(err => {
          console.log(err);
        })
      })
    },
    handlecloseAddStaff(){
      this.addStaffDialogVisible = false;
      this.$nextTick(() => {
        this.$refs.addStaffRef.resetFields();
      })
      this.staffInfo = {
        number: '',
        name: '',
        email: '',
        sex: 'Male',
        miniHours: '',
        position: '',
      };
    },
    editStaff(val){
      const _this = this;
      _this.staffInfo.number = val.number;
      _this.staffInfo.name = val.name;
      _this.staffInfo.email = val.emailAddress;
      _this.staffInfo.sex = val.sex;
      _this.staffInfo.position = val.position;
      _this.staffInfo.miniHours = val.minHours;
      _this.editStaffDialogVisible = true;
    },
    updateStaff(){
      const _this=this;
      _this.$refs.addStaffRef.validate(valid => {
        if(!valid) return;
        _this.$api.staff.updateStaff({
          number: _this.staffInfo.number,
          name: _this.staffInfo.name,
          sex: _this.staffInfo.sex,
          emailAddress: _this.staffInfo.email,
          position: _this.staffInfo.position,
          minHours: _this.staffInfo.miniHours,
        }).then(res => {
          if(res.data.code === 2000){
            _this.getPageStaff();
            _this.getAllStaff();
            _this.$message.success('Update successful');
            _this.editStaffDialogVisible = false;
            _this.staffInfo = {
              number: '',
              name: '',
              email: '',
              sex: 'Male',
              miniHours: '',
              position: '',
            };
          }else{
            _this.$message.error(res.data.message);
          }
        }).catch(err => {
          console.log(err);
        })
      })
    },
    handlecloseEditStaff(){
      this.editStaffDialogVisible = false;
      this.$nextTick(() => {
        this.$refs.addStaffRef.resetFields();
      })
      this.staffInfo = {
        number: '',
        name: '',
        email: '',
        sex: 'Male',
        miniHours: '',
        position: '',
      };
    },
    deleteStaff(val) {
      const _this=this;
      _this.$api.staff.deleteStaff({
        number: val.number
      }).then(res => {
        if(res.data.code === 2000){
          _this.getAllStaff();
          _this.getPageStaff();
          _this.$message.success('Delete successful');
        }else{
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    deleteFromDepart(index, number) {
      const _this=this;
      var department_id = _this.deDetail[index].id;
      _this.$api.department.deleteFromDepartment({
        number: number,
        department_id: department_id,
      }).then(res => {
        if(res.data.code === 2000){
          _this.getDepartStaff(index);
          _this.$message.success('Delete successful');
        }else{
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    getDeDetail(){
      const _this = this;
      _this.deDetail = _this.department.map((i)=> {
        return {
          id: i.id,
          name: i.name,
          managername: i.managername,
          color: i.color,
          tableVisible: false,
          tableData: [],
        }
      })
    },
    getDepartStaff(index){
      const _this = this;
      var department_id = _this.deDetail[index].id;
      _this.$api.staff.getDepartStaff({
        department_id: department_id,
      }).then(res => {
        if(res.data.code === 2000){
          _this.deDetail[index]["tableData"] = res.data.data;
        }else{
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    addStaffTo(){
      const _this = this;
      var index = _this.addStaffToDepartment.index;
      console.log(index);
      var department_id = _this.deDetail[index].id;
      console.log(department_id);
      _this.$api.department.addToDepartment({
        number: _this.addStaffToDepartment.number,
        department_id: department_id,
      }).then(res => {
        if(res.data.code === 2000){
          _this.getDepartStaff(index);
          _this.$message.success('Add successful');
        }else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
      _this.addDialogVisible = false;
    },
    addDepartment(){
      const _this = this;
      console.log(_this.departmentInfo)
      console.log(_this.departmentInfo.manager.toString())
      _this.$api.department.addDepartment({
        departmentname: _this.departmentInfo.name,
        manager_number: _this.departmentInfo.manager.toString(),
        color: _this.departmentInfo.color
      }).then(res => {
        if(res.data.code === 2000){
          _this.getAllDepartment();
          _this.$message.success('Add successful');
          _this.handlecloseInner();
        }else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    handleOpenEdit(val){
      const _this =this;
      _this.editDepartmentInfo = _this.department[val];
      _this.$api.department.getManager({
        departmentid: _this.editDepartmentInfo.id,
      }).then(res => {
        if(res.data.code === 2000){
          _this.editDepartmentInfo.manager = res.data.data.map((item) => {
            return item.number;
          });
          // _this.editDepartmentInfo['manager'] = [];
          // res.data.data.map((item) => {
          //   _this.editDepartmentInfo['manager'].push(item.number)
          //   // return item.number;
          // });
          console.log(_this.editDepartmentInfo.manager);
          _this.editDeVisible = true;
        }
      }).catch(err => {
        console.log(err);
      })
    },
    editDepartment(){
      const _this = this;
      _this.$api.department.updateDepartment({
        departmentid: _this.editDepartmentInfo.id,
        departmentname: _this.editDepartmentInfo.name,
        manager_number: _this.editDepartmentInfo.manager.toString(),
        color: _this.editDepartmentInfo.color
      }).then(res => {
        if(res.data.code === 2000){
          _this.getAllDepartment();
          _this.$message.success('Update successful');
          _this.editDeVisible = false;
        }else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    },
    handlecloseInner() {
      const _this =this;
      Object.keys(_this.departmentInfo).forEach(((value) => {
        _this.departmentInfo[value] = '';
      }))
      _this.departmentInfo.manager = [];
      _this.innerVisible = false;
    },
    deleteDepart(val) {
      const _this = this;
      _this.$api.department.deleteDepartment({
        departmentid: val
      }).then(res => {
        if(res.data.code === 2000){
          _this.getAllDepartment();
          _this.$message.success('Delete successful');
        }else {
          _this.$message.error(res.data.message);
        }
      }).catch(err => {
        console.log(err);
      })
    }
  },
}
</script>

<style lang="less" scoped>
  #box {
    height: 100%;
    width: 100%;
    position: fixed;
    background-color: #F2F2F2;
    z-index: -1;
  }

  #base {
    padding: 100px 0 0 250px;
    // height: 663px;
    // background-color: #F2F2F2;
  }

  .content {
    padding-bottom: 20px;
    width: 1269px;
    background-color: #F2F2F2;
    float: left;
  }

  #circle1 {
    border-width: 1px;
    position: fixed;
    left: 1318px;
    top: -39px;
    width: 150px;
    height: 150px;
    display: flex;
    border-radius:50%;
    background-color: rgba(253,167,105,0.24);
  }

  #circle2 {
    border-width: 1px;
    position: fixed;
    left: 1418px;
    top: 61px;
    width: 100px;
    height: 100px;
    display: flex;
    border-radius:50%;
    background-color: rgba(150,169,97,0.24);
  }

  .tabbar {
    margin: 0 0 0 250px;
    padding-top: 10px;
    padding-bottom: 10px;
    background-color: #F2F2F2;
    z-index: 100;
    position: fixed;
  }

  .page-header {
    width: 1234px;
    height: 64px;
    background-color: rgba(242,235,211,0.3);
    border: 2px solid rgba(150, 169, 97,0.5);
    border-radius: 5px;
    margin: 0 20px 0 15px;
    line-height: 64px;
    span {
      color: #473C33;
      margin-left: 10px;
      font-size: 30px;
      // font-weight: 600;
    }
    .el-icon-department{
      margin-left: 20px;
      font-size: 35px;
      color: #ABC270;
      // vertical-align: middle;
    }
  }

  .collapse-item {
    margin-top: 5px;
    margin-left: 15px;
    .title {
      width: 800px;
      height: 90px;
      background-color: rgba(242,235,211,0.3);
      border: 2px solid rgba(150, 169, 97,0.5);
      border-radius: 5px;
    }
    /deep/ .el-table {
      margin-top: 5px;
      width: 800px;
    }
  }

  // /deep/ .el-collapse-item {
  //   width: 800px;
  //   margin-left: 15px;
  // }

  // /deep/ .el-collapse-item__header {
  //   width: 800px;
  //   height: 90px;
  //   background-color: rgba(242,235,211,0.3);
  //   border: 2px solid rgba(150, 169, 97,0.5);
  //   border-radius: 5px;
  // }

  .department {
    width: 800px;
    height: 90px;
    text-align: center;
    .first-row {
      margin: 0 auto;
      line-height: 45px;
      height: 40px;
      span {
        color: #473C33;
        margin-left: 10px;
        font-size: 20px;
        // font-weight: 600;
      }
      .el-icon-department{
        font-size: 30px;
        color: #ABC270;
        vertical-align: middle;
      }
      .symbol {
        display: inline-block;
        // vertical-align: middle;
        margin-left: 10px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        // background-color: red;
      }
    }

    .second-row {
      margin: 0 auto;
      line-height: 45px;
      height: 50px;
      div{
        display: inline-block;
        vertical-align: middle;
      }
      .el-icon-manager{
        font-size: 25px;
        color: #ABC270;
        vertical-align: middle;
      }
      .manager {
        margin-left: 10px;
        height: 30px;
        width: 235px;
        line-height: 30px;
        border-radius: 5px;
        background-color: rgba(150, 169, 97,0.2);
        span {
          margin: 0 5px;
          font-size: 13px;
          color: #96A961;
        }
      }
      .el-icon-file-editing {
        margin-left: 10px;
        font-size: 25px;
        color: rgba(246,119,28,0.9);
        vertical-align: middle;
      }
    }
  }

  .icon {
    position: absolute;
    right: 10px;
    .el-icon-add{
      margin-right: 10px;
      font-size: 25px;
      color: rgba(246,119,28,0.9);
      vertical-align: middle;
      cursor: pointer;
    }
    .el-icon-arrow-right {
      font-size: 25px;
      color: rgba(246,119,28,0.9);
      vertical-align: middle;
      cursor: pointer;
    }
    .active {
      transform: rotate(90deg);
      transition: transform .3s;
    }
    .back {
      transition: transform .3s;
    }
  }

  /deep/ .el-table--border{
    border: 2px solid rgba(150, 169, 97,0.5);
    border-radius: 5px;
  }

  /deep/ .el-table__empty-block {
    background-color: #F2F2F2;
  }

  /deep/ .el-table tr{
    background-color: #F2F2F2;
  }

  /deep/ .el-table td{
    border: 0px;
    border-top: 1px solid rgba(150, 169, 97,0.5);
  }

  /deep/ .el-table__cell, .el-table__expanded-cell{
    background-color: #F2F2F2;
  }

  .el-icon-delete,.el-icon-file-editing {
    margin-right: 10px;
    font-size: 20px;
    color: rgba(246,119,28,0.9);
    vertical-align: middle;
    cursor: pointer;
  }

  .employee {
    // float: right;
    // margin-top: 5px;
    top: 100px;
    left: 1090px;
    bottom: 30px;
    position: fixed;
  }

  .editDe {
    cursor: pointer;
    width: 410px;
    height: 40px;
    background-color: rgba(150,169,97,0.2);
    border-radius: 5px;
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    color: #96A961;
    .el-icon-add {
      font-size: 20px;
      color: rgba(246,119,28,0.9);
      // vertical-align: middle;
      margin-right: 10px;
    }
  }

  .employee-detail {
    width: 410px;
    // height: 590px;
    height: 95%;
    margin-top: 5px;
    background-color: rgba(150,169,97,0.2);
    border-radius: 5px;
    border: 2px solid rgba(150, 169, 97,0.5);
    .search-staff{
      width: 390px;
      margin: 10px 10px;
    }
    /deep/ .el-icon-search{
      color: #96A961;
    }
    /deep/ .el-input--prefix{
      color: #96A961;
    }
    /deep/ .el-input__inner {
      background-color: rgba(150,169,97,0.2);
    }
    /deep/ input::-webkit-input-placeholder {
      color: #96A961;
    }
    .staff-list{
      width: 390px;
      margin: 0 10px;
      margin-bottom: 5px;
    }
  }

  /deep/ .el-table .cell {
    word-break: keep-all;
  }

  .page {
    position: absolute;
    right: 5px;
  }

  .add-staff {
    cursor: pointer;
    position: absolute;
    bottom: 20px;
    left: 10px;
    width: 390px;
    height: 40px;
    // margin: 10px 10px;
    background-color: rgba(150,169,97,0.2);
    border-radius: 5px;
    line-height: 40px;
    text-align: center;
    color: #96A961;
    font-size: 18px;
    .el-icon-add {
      font-size: 20px;
      color: rgba(246,119,28,0.9);
      margin-right: 10px;
    }
  }

  /deep/ .el-dialog__body{
    padding-top: 10px;
    padding-left: 40px;
    padding-bottom: 0px;
  }

  .edit-department{
    width: 95%;
    .title{
      line-height: 30px;
      font-size: 16px;
      font-weight: 600;
      .el-icon-add {
        font-size: 18px;
        color: rgba(246,119,28,0.9);
        margin-left: 10px;
        vertical-align: middle;
        cursor: pointer;
      }
    }
    .department-list {
      line-height: 30px;
      font-size: 14px;
      .el-icon-delete {
        margin-right: 10px;
        font-size: 18px;
        color: rgba(246,119,28,0.9);
        vertical-align: middle;
        cursor: pointer;
      }
    }
  }

</style>
